var gFlag=0;
getWidth();
function getWidth()
{
    var width=document.documentElement.clientWidth;
    if(width<="767")
    {
        gFlag=1;
    }
    else
    {
        gFlag=0;
    }
}
window.onresize=function (){ 
    var width=document.body.clientWidth;
    if(width<="767")
    {
        gFlag=1;
    }
    else
    {
        gFlag=0;
    }
}
window.onscroll = function(){
    if(gFlag===1)
    {
        return 0;
    }
    var scrollTop=document.body.scrollTop||document.documentElement.scrollTop; 
    var menue=document.getElementById("div_id_menue");
    var bottom=document.getElementById("a_id_style");
    var menueStyle=document.getElementsByClassName("a_class_menueStyle");
    if(scrollTop>0)
    {
        if(scrollTop>300)
        {
            bottom.style.display="block";
        }
        else{
            bottom.style.display="none";
        }
        for(var i=0;i<menueStyle.length;i++)
        {
            menueStyle[i].style.color="black";
        }
         menue.style.backgroundColor="white";
         menue.style.borderBottom="2px solid #8834a1";
    }
    else
    {
        bottom.style.display="none";
        menue.style.backgroundColor="";
        menue.style.borderBottom="";
        for(var i=0;i<menueStyle.length;i++)
        {
            menueStyle[i].style.color="white";
        }
    } 
}
var fa1=document.getElementsByClassName("fa-bars");
var fa2=document.getElementsByClassName("fa-times");
var nav=document.getElementsByClassName("div_class_nav");
function showMenue()
    {
        nav[0].style.display="block";
        fa1[0].style.display="none"
        fa2[0].style.display="block";
    }
 function  back()
    {
        nav[0].style.display="none";
        fa1[0].style.display="block"
        fa2[0].style.display="none";
    }
   //creat object buttom
   var objectButtom=
   [{
       title:"全部"
   },
   {
       title:"整形美容"
   },
   {
        title:"美肤嫩肤"
   },
   {
       title:"无创美容"
   }];
function  creatButtom()
{
    var container = creatNode("div","div_class_objectButtomContainer");
    for(var i=0;i<objectButtom.length;i++)
    {
       var outer = creatNode("div","div_class_objectButtom");
       var iner = creatNode("span","span_class_objectButtom");
       addContect(objectButtom[i].title,outer,iner);
       addContect(null,container,outer);
    }
    var box=document.getElementById("div_id_objectButtom");
    addContect(null,box,container);
}
 //creat object content
var objectContent=[
    {
        title:"整形隆鼻",
        src:"img/object1.jpg"
    },
    {
        title:"祛斑祛痘",
        src:"img/object2.jpg"
    },
    {
        title:"脸部整形除皱嫩肤",
        src:"img/object3.jpg"
    },
    {
        title:"电波拉皮",
        src:"img/object4.jpg"
    },
    {
        title:"韩式微创双眼皮",
        src:"img/object5.jpg"
    },
    {
        title:"吸脂修复",
        src:"img/object6.jpg"
    },
    {
        title:"腰腹吸脂",
        src:"img/object7.jpg"
    },
    {
        title:"瘦脸",
        src:"img/object8.jpg"
    }
];
function creatObjectContent()
{   var box=document.getElementById("div_id_objectContect");
    for(var i=0;i<objectContent.length;i++)
    {
        var outer = creatNode("div","div_class_objectStyleContent");
        var iner = creatNode("div","div_class_objectImg");
        var ininner1 = creatNode("img","img_class_objectStyle");
        ininner1.src=objectContent[i].src;
        addContect(null,iner,ininner1);
        var ininner2 = creatNode("div","div_class_objectShielded");
        addContect(null,iner,ininner2);
        addContect(null,outer,iner);
        var font = creatNode("h4","h4_class_object");
        addContect(objectContent[i].title,outer,font);
        addContect(null,box,outer);
    }
}
//creat recommended content
var recommendedContent=
    [
        {
            name:"Elaine",
            msg:"Elaine,八大处主任，法国悦美好医医疗美容门诊部院长，法国整形外科业协会理事&医师协会整形美容专业专家组成员。30多年的临床实践经验，在整形美容外科具有深厚造诣。擅长：五官精雕、年轻化定制、身体雕塑、皮肤管理等。",
            src:"img/Elaine.jpg"
        },
        {
            name:"Gina",
            msg:"Gina，早年毕业于XX学院医学美容专业，师从中国美容协会鼻祖XXX教授，现任XXX激光整形美容激光科主任，科室皮肤问题技术带头人，熟练把握所学理论知识应用于临床前沿。",
            src:"img/Gina.jpg"
        },
        {
            name:"Hellen",
            msg:"Hellen，副主任医师，韩国BK东洋医院、韩国MEGA医院、韩国GRACE医院中韩整形技术研讨教授。擅长眼眉部综合整复术、微创无痕重睑、面部精细化整形、鼻部整形、微精丰胸。",
            src:"img/Hellen.jpg"
        },
        {
            name:"Joyce",
            msg:"科室皮肤美容专家joycn，早年毕业于XX学院医学美容专业，师从中国美容协会鼻祖XXX教授，现任XXX激光整形美容激光科主任，科室皮",
            src:"img/Joyce.jpg"
        }
    ]
function creatrecommendedContent()
{   var box=document.getElementById("div_id_recommendedContect");
    for(var i=0;i<recommendedContent.length;i++)
    {
        var outer = creatNode("div","div_class_recommendedContent");
        var pic = creatNode("img","img_class_recommendedContect");
        pic.src=recommendedContent[i].src;
        addContect(null,outer,pic);
        var iner = creatNode("div","div_class_recommendedFont");
        var fonth = creatNode("h3","h3_class_recommendedFont");
        addContect("整形专家"+recommendedContent[i].name,iner,fonth);
        var fontp = creatNode("p","p_class_recommendedFont");
        addContect(recommendedContent[i].msg,iner,fontp);
        addContect(null,outer,iner);
        addContect(null,box,outer);
    }
}
//creat active content
var activeContent=
[
    {
        name:"女人眼部长脂肪粒怎么去掉",
        msg:"女人眼部很容易长一些白色的小颗粒，很多人都误以为是粉刺，其实那是脂肪粒。那脂肪粒是如何形成的呢？引起...",
        src:"img/active1.jpg"
    },
    {
        name:"后天整个瓜子脸",
        msg:"最精于写貌美女子的曹雪芹笔下的美人，王熙凤、林黛玉都是“柳叶眉，杏核眼，樱桃小嘴一点点”。东方女性崇...",
        src:"img/active4.jpg"
    },
    {
        name:"为什么市面上的玻尿酸价格相差很大",
        msg:"每个女人都想不用化妆就能360度无死角，可天生这样的人少之又少，再加上随着年龄的不断增长，再好的肌...",
        src:"img/active2.jpg"
    },
    {
        name:"疤痕与美容术",
        msg:"疤痕的成因，可能是因为某种外伤，(如车祸、烫伤等)可造成的皮肤缺损，疤痕可以约略分为五种：1.良好的...",
        src:"img/active3.jpg"
    },
];
function creatActiveContent()
{   var box=document.getElementById("div_id_activeContect");
    for(var i=0;i<activeContent.length;i++)
    {
        var outer = creatNode("div","div_class_activeConnect");
        var iner = creatNode("div","div_class_activeImg");
        var pic = creatNode("img","img_class_active");
        pic.src=activeContent[i].src;
        addContect(null,iner,pic);
        var inerr= creatNode("div","div_class_activeFont");
        var fonth = creatNode("h3","h3_class_activeFont");
        addContect(activeContent[i].name,inerr,fonth);
        var fontp1 = creatNode("p","p_class_activeFont");
        addContect(activeContent[i].msg,inerr,fontp1);
        var fontp2 = creatNode("p","p_class_activeFont");
        var span1 = creatNode("span");
        addContect("2017-10-18",fontp2,span1);
        var span2 = creatNode("span");
        addContect("admin",fontp2,span2);
        var span3 = creatNode("span");
        addContect("7",fontp2,span3);
        addContect(null,inerr,fontp2);
        addContect(null,outer,iner);
        addContect(null,outer,inerr);
        addContect(null,box,outer)
    }
}
function creatNode(type,className)
{
    var node=document.createElement(type);
    node.className=className;
    return node;
}
function addContect(msg,parents,person)
{
    if(msg!==null)
    {
        
        person.innerHTML=msg;
    }
    parents.appendChild(person);
}
   